package algorithm.leetcode.I401to600;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

/**
 * 8 7 4 3 3 2 2 1
 * 8 7 6 5 4 3 2 1
 */

public class Q448 {

    public List<Integer> findDisappearedNumbers(int[] nums) {
        int n = nums.length;
        for (int num : nums) {
            int x = (num - 1) % n;
            nums[x] += n;
        }
        List<Integer> ret = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            if (nums[i] <= n) {
                ret.add(i + 1);
            }
        }
        return ret;
    }


    public static void main(String[] args) {
        Q448 q448 = new Q448();
        System.out.println(q448.findDisappearedNumbers(new int[]{1,3,4,4,5,6,6,7,7,8}));
    }

}
